public class qianxuTrees {
    class Solution {

        Stack<TreeNode> stack = new Stack<>();
        TreeNode node = root;
    while(!stack.isEmpty()){
            while(cur!=null){
                stack.push(node);
                system.out.print(node.val+" ");
                node=node.left;
            }
            TreeNode top = stack.pop();
            node = top.right;
        }
    }}
